NotchFilterA notch filter audio effector that attenuates a very narrow frequency band around a configurable center frequency. It is commonly used to remove resonances, hum (e.g. 50/60 Hz), or feedback frequencies without significantly affecting the rest of the spectrum.
Internally this effector runs its filtering inside the NotchFilterProcessor AudioWorklet processor.
Extends Effector.
Exported from the package root since version 0.4.9: import { NotchFilter } from "@fluex/fluexgl-dsp". NotchFilterOptions and NotchFilterMessageCommandId are exported as well.
// Not exported from "@fluex/fluexgl-dsp" yet - see note above.
import NotchFilter from "fluexgl-dsp/lib/src/effects/classes/filters/NotchFilter";
const notch = new NotchFilter({
cutoff: 50,
q: 10
});
...
channel.addEffect(notch);
new NotchFilter(options?: Partial<NotchFilterOptions>): NotchFilter;
options?: Partial<NotchFilterOptions>cutoff, q, minFrequency, strictMode).label: string | nullCustom label for this effector. Defaults to "NotchFilter".
name: stringInternal name for this effector. Defaults to "NotchFilter".
cutoff: numberCenter frequency in Hz. Defaults to 1000.
minFrequency: numberLower bound applied to minFrequency by setMinFrequency(). Defaults to 10.
q: numberResonance/Q factor, clamped between 0.0001 and 4 by setQ(). Defaults to 0.7.
strictMode is tracked internally but, unlike the other filter effectors, is declared private on this class rather than public.
initializeOnAttachment(context: AudioContext): Promise<void>Initializes the filter by creating the AudioWorklet processor node (NotchFilterProcessor) with the current option values.
context: AudioContextPromise<void>returnOptionsAsObject(): NotchFilterOptionsReturns a plain object snapshot of the current cutoff, q, strictMode and minFrequency values.
NotchFilterOptionssetCutoff(cutoff?: number): booleanUpdates cutoff and forwards the change to the AudioWorklet processor.
cutoff?: number - Defaults to 1000 when omitted.boolean - false if this effect has no context yet, otherwise the result of sending the message to the processor.setMinFrequency(minFrequency?: number): booleanUpdates minFrequency (floored at 10) and forwards the change to the AudioWorklet processor.
minFrequency?: number - Defaults to the current minFrequency when omitted.booleansetQ(q?: number): booleanUpdates q, clamped between 0.0001 and 4, and forwards the change to the AudioWorklet processor.
q?: number - Defaults to 0.7 when omitted.booleanInherited from Effector (incoming-processor-message, incoming-processor-warning, incoming-processor-error, processor-wasm-instantiated).
This class does not define public getters or setters.